<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>新增权限</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="__STATIC__/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__STATIC__/layuiadmin/style/admin.css" media="all">
</head>
<body>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">{:lang('edit_auth')}</div>
                <div class="layui-card-body" pad15>
                    <div class="layui-form" lay-filter="user">
                        <div class="layui-form-item">
                            <label class="layui-form-label">{:lang('parent_id')}</label>
                            <div class="layui-input-inline">
                                <select name="parent_id" lay-verify="required">
                                    <option value="0">{:lang('top menu')}</option>
                                    {volist name="data_lists" id="value"}
                                    <option value="{$value.id}" {if condition="($value.id == $data_oneData.parent_id)"}selected{/if}>{$value.auth_name}</option>
                                    {/volist}
                                </select>
                            </div>
                            <div class="layui-form-mid layui-word-aux"></div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">{:lang('auth_name')}</label>
                            <div class="layui-input-inline">
                                <input type="text" name="auth_name" value="{$data_oneData.auth_name}" lay-verify="required" autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">{:lang('auth_rules')}</label>
                            <div class="layui-input-inline">
                                <input type="text" name="auth_rules" value="{$data_oneData.auth_rules}" lay-verify="required" autocomplete="off"
                                       class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">不可重复</div>
                        </div>
                        <div class="layui-form-item" pane>
                            <label class="layui-form-label">{:lang('is_tyle')}</label>
                            <div class="layui-input-block">
                                <input type="radio" name="is_tyle" value="0" title="菜单" {if condition="($data_oneData.is_tyle == 0)"}checked{/if}>
                                <input type="radio" name="is_tyle" value="1" title="节点" {if condition="($data_oneData.is_tyle == 1)"}checked{/if}>

                            </div>
                        </div>
                        <input type="hidden" name="ids" value="{$data_oneData.id}">
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="addauthinfo">立即提交</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重新填写</button>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>

<script src="__STATIC__/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '__STATIC__/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'layer', 'jquery'], function () {
        var form = layui.form;
        var layer = layui.layer;
        var $ = layui.jquery;
        form.on('submit(addauthinfo)', function (data) {
            var load = layer.load(0, {
                shade: 0.5
            });
            $.ajax({
                url : "{:url('Api/Auth/edit')}",
                data: data.field,
                type: "post",
                dataType:"json",
                success:function (res) {
                    layer.close(load);
                    if (res.code === '200'){
                        layer.msg(res.msg);
                        window.location.reload(true);
                    }else{
                        layer.msg(res.msg);
                    }
                }
            });
            return false;
        });

    });
</script>
</body>
</html>